//
//  AddWaterView.m
//  pa
//
//  Created by HaiJiao Chen on 12-7-30.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "AddWaterView.h"
#import "AppDelegate.h"
#import "MainObject.h"
#import "TicketList.h"
#import "UIPlaceHolderTextView.h"
#import "FilePack.h"
#include "text_def.h"

@implementation AddWaterView
@synthesize gal;
@synthesize note;


- (IBAction)back:(id)sender
{
    [self removeFromSuperview];
}
- (IBAction)save:(id)sender
{
    NSMutableDictionary* dic = [AppDelegate sharedInstance].main.ticketsDataSource.memoryObject;
    dic = [dic valueForKey:[NSString stringWithFormat:@"%lld", ticketID]];
    [dic setValue:note.text forKey:DRIVER_NOTE];
    [dic setValue:gal.text forKey:ADD_WATER_GAL];
    [[NSNotificationCenter defaultCenter] postNotificationName:DataSourceChangeNotification object:[AppDelegate sharedInstance].main.ticketsDataSource userInfo:[NSDictionary dictionaryWithObject:[NSArray arrayWithObject:[NSNumber numberWithLongLong:ticketID]] forKey:@"changed"]];
    [self removeFromSuperview];
}

-(void)viewLoadFromNib:(NSNumber*)param
{
    ticketID = [param longLongValue];
    NSMutableDictionary* dic = [AppDelegate sharedInstance].main.ticketsDataSource.memoryObject;
    dic = [dic valueForKey:[NSString stringWithFormat:@"%lld", ticketID]];
    note.temp = UIEdgeInsetsMake(-5, -5, 10, 0);
    note.placeholderOffset = CGPointMake(8, 8);
    note.placeholder = [FilePack getStringByID:STR_NOTE];
    note.text = [dic valueForKey:DRIVER_NOTE];
    
    gal.text = [dic valueForKey:ADD_WATER_GAL];
}
@end
